package com.gitee.ykr.lightweight.rpc.protocol.serializer;

import com.alibaba.fastjson.JSON;
import com.gitee.ykr.lightweight.rpc.util.SerializationUtil;

/**
 * @author YKR
 * @Describe
 * @date 2021/8/24
 */
public class SerializerExecutor {
    public static <T> byte[] serialize(T object) {
        byte[] bytes = null;

        bytes = SerializationUtil.serialize(object);
        return bytes;
    }

    public static <T> T deserialize(byte[] bytes,Class<T> clazz) {

        T object = null;

        object = SerializationUtil.deserialize(bytes);

        return object;
    }

    public static String toJson(Object object) {
        return JSON.toJSONString(object);
    }
}
